<template>
  <div class="container">
    <span class="title">后台管理</span>
    <div class="nav">
      <router-link to="/admin/manage/checkin">客户入住/退房</router-link>
      <router-link to="/admin/manage/room">房间管理</router-link>
      <router-link to="/admin/manage/oneself">个人中心</router-link>
      <router-link to="/admin/manage/hotel">酒店信息管理</router-link>
    </div>
    <span class="login-out" @click="loginOut">退出</span>
  </div>
</template>

<script>
import Store from "@/store";

export default {
  name: "AdminNav",
  data(){
    return{

    }
  },
  methods: {
    loginOut(){
      this.$router.push("/admin")
      Store.commit('delAdminTokenValue')
    }
  },
  created() {
    console.log(Store.getters.getAdminTokenValue)
    if (Store.getters.getAdminTokenValue === null){
      this.$router.push("/admin")
    }
  }
}
</script>

<style scoped lang="less">
.container{
  height: 64px;
  background: #e8e6e6;
  display: flex;
  align-items: center;
  font-weight: 600;
  box-shadow: 0 0 4px 4px darkgrey;
  .title{
    flex-grow: 1;
  }
  .nav{
    flex-grow: 8;
    display: flex;
    a{
      color: black;
      margin: 0 16px;
      text-decoration: none;
      cursor: pointer;
    }
  }
  .login-out{
    flex-grow: 1;
    cursor: pointer;
  }
}

</style>